1 /*******************************************************************************
2 * Copyright (c) 2000, 2011 IBM Corporation and others.
3 *
4 * This program and the accompanying materials
5 * are made available under the terms of the Eclipse Public License 2.0
6 * which accompanies this distribution, and is available at
7 * https://www.eclipse.org/legal/epl-2.0/
8 *
9 * SPDX-License-Identifier: EPL-2.0
10 *
11 * Contributors:
12 * IBM Corporation - initial API and implementation
13 *******************************************************************************/
14 package org.eclipse.swt.custom;
15
16
17 import org.eclipse.swt.internal.SWTEventListener;
18
19 /**
20 * The StyledText widget implements this listener to receive
21 * notifications when changes to the model occur.
22 * It is not intended to be implemented by clients or by
23 * implementors of StyledTextContent.
24 * Clients should listen to the ModifyEvent or ExtendedModifyEvent
25 * that is sent by the StyledText widget to receive text change
26 * notifications.
27 * Implementors of StyledTextContent should call the textChanging
28 * and textChanged methods when text changes occur as described
29 * below. If the entire text is replaced the textSet method
30 * should be called instead.
31 */
32 public interface TextChangeListener extends SWTEventListener {
33
34 /**
35 * This method is called when the content is about to be changed.
36 * Callers also need to call the textChanged method after the
37 * content change has been applied. The widget only updates the
38 * screen properly when it receives both events.
39 *
40 * @param event the text changing event. All event fields need
41 * to be set by the sender.
42 * @see TextChangingEvent
43 */
textChanging(TextChangingEvent event)44 public void textChanging(TextChangingEvent event);
45 /**
46 * This method is called when the content has changed.
47 * Callers need to have called the textChanging method prior to
48 * applying the content change and calling this method. The widget
49 * only updates the screen properly when it receives both events.
50 *
51 * @param event the text changed event
52 */
textChanged(TextChangedEvent event)53 public void textChanged(TextChangedEvent event);
54 /**
55 * This method is called instead of the textChanging/textChanged
56 * combination when the entire old content has been replaced
57 * (e.g., by a call to StyledTextContent.setText()).
58 *
59 * @param event the text changed event
60 */
textSet(TextChangedEvent event)61 public void textSet(TextChangedEvent event);
62 }
63
64
65